package com.gitee.sunstar.mainmodel

import android.util.Log
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
import android.os.Looper




class TestApiCall {

    enum class CallType {
        Video
    }


    fun testApi(page: Int, size: Int, type: CallType) {
        GlobalScope.launch(Dispatchers.IO) {
            Log.e("mainThread","${isMainThread()}")
//            val data = apiServer.getTestUrl(page, size, "video").await()
            GlobalScope.launch(Dispatchers.Main) {
                Log.e("mainThread","${isMainThread()}")
//                data.result.forEach {
//                    Log.e("mainThread","${it.toString()}")
//                }

            }
        }

    }
    fun isMainThread(): Boolean {
        return Looper.getMainLooper().thread === Thread.currentThread()
    }
}